#include<iostream>
#include<vector>

using namespace std;

const int N = 1e5;
vector<int>q[N];

bool ch[N];


void dfs(int x)
{
	cout << x << " ";
	ch[x] = true;
	for (auto e : q[x])
	{
		if (!ch[e])
		{
			dfs(e);
		}
	}
}

int main()
{
	int a; cin >> a;
	while (--a)
	{
		int x, y; cin >> x >> y;
		q[x].push_back(y);
		q[y].push_back(x);
	}
	dfs(1);
	return 0;
}
